home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-14 | 760 b | 26 lines | [TEXT/MPS ] |
- CASE ON
- FindKeyIndex PROC EXPORT ;Modula saves registers across call.
- ;Modula clears the return value.
-
- MOVEA.L (SP)+,A0 ;get return address
- MOVE.W (SP)+,D1 ;get totFil
- MOVE.W (SP)+,D0 ;get index
-
- MOVE.L (SP)+,D2 ;get array pointer
- ADDQ.L #2,D2 ;point to first element [1]
- MOVEA.L D2,A1 ;let's use it directly
-
- LOOP CMP.W (A1)+,D0 ;does it point to index?
- BEQ.S ReturnVal
- DBF D1,LOOP
- BRA.S ExitGraceless
-
- ReturnVal SUB.L D2,A1 ;subtract out the pointer to [1]
- MOVE.L A1,D2 ;(A1 points just past testee)
- ASR.L #1,D2 ;divide by 2
- MOVE.W D2,(SP) ;save in return space
-
- ExitGraceless JMP (A0)
- ENDP
-
- END